package com.example.dao;

import com.example.domain.Product;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Date: 2021年08月17日 12:29
 * @Author: LHSAMA
 */
@Repository
public interface IProductDao {

    @Select("select * from product where id = #{id}")
    Product findById(String id) throws Exception;

//    查询所有商品信息
    @Select("select * from product")
    List<Product> findAll() throws Exception;

    @Insert("insert into product(productNum,productName,cityName,departureTime,productPrice,productDesc,productStatus) values(#{productNum},#{productName},#{cityName},#{departureTime},#{productPrice},#{productDesc},#{productStatus})")
    void save(Product product);

}
